package rocket.users;

import java.sql.Connection;
import java.util.ArrayList;
import java.util.List;

import rocket.medical.Treatment;
import rocket.logs.WriteType;
import rocket.pokemon.Pokemon;
import rocket.server.Access;
import rocket.logs.Write;
/**
 * 
 * @author justin
 *
 * @version
 */
public class Trainer extends User{

	private final Access access = Access.TRAINER;

	private long id;
	
	private String birthDate;

	private String city;
	
	private String gender;
	
	private String insurance;
	
	private String name;
	
	private String pharmacy;
	
	private String phone;
	
	private String region;
	
	private String log;

	private List<Treatment> treatments;
	
	private ArrayList<Pokemon> pokemon;
	
	private NurseJoy prefNurse;
	
	private Professor prefProf;

	public Trainer(long id, String birthDate, String city, String gender,
			String insurance, String name, String pharmacy, String phone,
			String region, List<Treatment> treatments) {
		this.id = id;
		this.birthDate = birthDate;
		this.city = city;
		this.gender = gender;
		this.insurance = insurance;
		this.name = name;
		this.pharmacy = pharmacy;
		this.phone = phone;
		this.region = region;
		this.setTreatments(treatments);
		pokemon = new ArrayList<Pokemon>();
	}
	
	public void setNurse(NurseJoy n){
		prefNurse = n;
		log = access.toString() + " " + name + " set new prefered nurse: " + n.name();
		writeLog(log);
	}
	
	public NurseJoy getNurse(){
		return prefNurse;
	}

	public void setProf(Professor p){
		prefProf = p;
		log =  access.toString() + " " + name + " set new prefered professor: " + p.name();
		writeLog(log);
	}

	public Professor getProf(){
		return prefProf;
	}
	
	public void addPokemon(Pokemon p){
		pokemon.add(p);
		log =  access.toString() + " " + name + " added a Pokemon";
		writeLog(log);
	}
	
	public ArrayList<Pokemon> getPokemon(){
		return pokemon;
	}
	
	public boolean removePokemon(Pokemon p){
		if (pokemon.contains(p)){
			pokemon.remove(p);
			log =  access.toString() + " " + name + " removed a Pokemon";
			writeLog(log);
			return true;
		}
		else return false;
	}
	
	@Override
	public String birthDate() {
		// TODO Auto-generated method stub
		return birthDate;
	}

	@Override
	public String city() {
		// TODO Auto-generated method stub
		return city;
	}

	@Override
	public String gender() {
		// TODO Auto-generated method stub
		return gender;
	}

	@Override
	public Access getAccess() {
		// TODO Auto-generated method stub
		return access;
	}

	@Override
	public Long getID() {
		// TODO Auto-generated method stub
		return id;
	}

	@Override
	public String insurance() {
		// TODO Auto-generated method stub
		return insurance;
	}

	@Override
	public String name() {
		// TODO Auto-generated method stub
		return name;
	}

	@Override
	public String pharmacy() {
		// TODO Auto-generated method stub
		return pharmacy;
	}

	@Override
	public String phone() {
		// TODO Auto-generated method stub
		return phone;
	}

	@Override
	public List<Treatment> record() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<Treatment> record(String date) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<Treatment> record(String startDate, String endDate) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String region() {
		// TODO Auto-generated method stub
		return region;
	}
	
	@Override
	public void writeLog(String s) {
		// TODO Auto-generated method stub
		new Write(WriteType.USER, s);
	}

	@Override
	public void setConnection(Connection con) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void setID(long id) {
		// TODO Auto-generated method stub
		
	}
	
	public String toString(){
		return name;
	}

	public void setTreatments(List<Treatment> treatments) {
		this.treatments = treatments;
	}

	public List<Treatment> getTreatments() {
		return treatments;
	}


}